import pygame
import sys
import os

# 初始化 Pygame
pygame.init()

# 设置窗口
screen = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Pygame 显示中文")

font_path = "/usr/share/fonts/truetype/wqy/wqy-microhei.ttc"
font_size = 36
font = pygame.font.Font(font_path, font_size)

# 渲染中文文本
text_surface = font.render("你好，Pygame！欢迎来到中文世界！", True, (255, 0, 0))  # 红色文字

# 主循环
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

    screen.fill((255, 255, 255))  # 白色背景
    screen.blit(text_surface, (50, 250))  # 绘制文字
    pygame.display.flip()

pygame.quit()
sys.exit()
